﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace FirstGame.Objects
{
    public class Projectile : MovingObject
    {
        private const float ProjectiveSpeed = 25f;

        public Projectile(Texture2D sprite, Vector2 position, Vector2 speed)
        {
            speed = Vector2.Normalize(speed);
            speed.X *= ProjectiveSpeed;
            speed.Y *= ProjectiveSpeed;
            Position = position;
            Speed = speed;
            Sprite = sprite;
            SetBoundingBox();
        }

        public bool IsProjectileOutOfBounds(Coords min, Coords max)
        {
            UpdateObject();
            return Position.X > max.X
                   || Position.X < min.X
                   || Position.Y > max.Y
                   || Position.Y < min.Y;
        }
    }
}
